package action;

import java.util.ArrayList;

import DAO.Dao_Trust;
import Entity.TrustDistricts;
import Entity.TrustRegions;

import com.opensymphony.xwork2.ActionSupport;



public class DetailTrustRegion extends ActionSupport{
	private String nameTR;
	private String desTR;
	private String naCou;
	private boolean active;

	private TrustRegions TruRe;
	private ArrayList<TrustRegions> listTruRe;
	private String nameTD;
	private String desTD;
	private String region;

	private TrustDistricts truDis;
	private ArrayList<TrustDistricts> listDis;

	public ArrayList<TrustDistricts> getListDis() {
		return listDis;
	}

	public void setListDis(ArrayList<TrustDistricts> listDis) {
		this.listDis = listDis;
	}

	public String execute() throws Exception{
		Dao_Trust cont = new Dao_Trust();
		listTruRe = cont.getTrustRegions();

		int sizeList = listTruRe.size();
		for (int i = 0; i < sizeList; i++) {

			if (listTruRe.get(i).getNameTR().equals(nameTR)) {
				setTruRe(new TrustRegions(listTruRe.get(i).getNameTR(), listTruRe.get(i)
						.getDesTR(), listTruRe.get(i).getNaCou(), listTruRe.get(i)
						.isActive()));
			}
		}
		getTruRe();
		
		listDis = cont.getTrustDistricts(nameTR);

		return "success";
	}

	
	
	public String getNameTD() {
		return nameTD;
	}

	public void setNameTD(String nameTD) {
		this.nameTD = nameTD;
	}

	public String getDesTD() {
		return desTD;
	}

	public void setDesTD(String desTD) {
		this.desTD = desTD;
	}

	public String getRegion() {
		return region;
	}

	public void setRegion(String region) {
		this.region = region;
	}

	public TrustDistricts getTruDis() {
		return truDis;
	}

	public void setTruDis(TrustDistricts truDis) {
		this.truDis = truDis;
	}

	public String getNameTR() {
		return nameTR;
	}

	public void setNameTR(String nameTR) {
		this.nameTR = nameTR;
	}

	public String getDesTR() {
		return desTR;
	}

	public void setDesTR(String desTR) {
		this.desTR = desTR;
	}

	public String getNaCou() {
		return naCou;
	}

	public void setNaCou(String naCou) {
		this.naCou = naCou;
	}

	public boolean isActive() {
		return active;
	}

	public void setActive(boolean active) {
		this.active = active;
	}

	public TrustRegions getTruRe() {
		return TruRe;
	}

	public void setTruRe(TrustRegions truRe) {
		TruRe = truRe;
	}

	public ArrayList<TrustRegions> getListTruRe() {
		return listTruRe;
	}

	public void setListTruRe(ArrayList<TrustRegions> listTruRe) {
		this.listTruRe = listTruRe;
	}
	
	
}
